#pragma once
#include<iostream>
#include<cstdlib>
#include<time.h>
#include<vector>
#include"Card.h"
#include"Poker.h"
using namespace std;

#ifndef PLAYER_H
#define PLAYER_H
class Player
{
public:
   Player(int p=0,int CPU=1,int banker=0)
   {
       point = p;
       isCPU = CPU;
       isBanker = banker;
   }
   void setMycard(Card a)
   {
       if(mycard.size()<3)
       {
            mycard.push_back(a);
       }
   }
   void ResetMycard()
   {
       while(!mycard.empty())
       {
           mycard.pop_back();
       }
   }
   vector<Card> getMycard()
   {
       return mycard;
   }
   void setPoint(int win)
   {
       point += win;
   }
   void setCPU(int CPU)
   {
       isCPU = CPU;
   }
   void setBanker(int banker)
   {
       isBanker = banker;
   }
   void printMycard()
   {
       for (int i = 0; i < mycard.size(); i++)
       {
           mycard[i].printCard();
       }
       cout << endl;
   }
   int getPoint()
   {
       return point;
   }
   int getCPU()
   {
       return isCPU;
   }
   int getBanker()
   {
       return isBanker;
   }
   int Down2ten(int Card_num)
   {
       if(Card_num>10&&Card_num<14)
       {
           return 10;
       }
       else
       {
           return Card_num;
       }
   }
   int Cal_CardPoint()
   {
       int sum = 0;
       for (int i = 0; i < mycard.size(); i++)
       {
           if (mycard[i].getCardnum() == 14)
           {
               return 9;
           }
        }
        for (int i = 0; i < mycard.size();i++)
        {
            sum += Down2ten(mycard[i].getCardnum());
        }
        return sum % 10;
   }

private:
    vector<Card> mycard;
    int point;
    int isCPU;
    int isBanker;
    //int Level;
    //int Cardpoint;
};
#endif